#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from typing import List, NoReturn
from loguru import logger

from sqlalchemy.orm import Session
from sqlalchemy import column, func, select, update,insert ,delete
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import selectinload, noload
from sqlalchemy.sql import Select

from app.database.oracle import oracle_session
from app.models.oracle.QM_LAB_TH import QM_LAB_TH

from app.schemas.qm import CreateQm


@oracle_session
def create(db:Session,obj_in:CreateQm):
    db_obj = QM_LAB_TH(**obj_in.dict())
    db.add(db_obj)
    db.commit()



@oracle_session
def get_all(db:Session):
    res = db.execute(select(QM_LAB_TH)).mappings().first().get('QM_LAB_TH')
    return res.name




 
    



